<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
  xmlns:h="http://java.sun.com/jsf/html"
  xmlns:ui="http://java.sun.com/jsf/facelets"
  xmlns:f="http://java.sun.com/jsf/core">
  <head>
  </head>
  <body>
    <ui:composition template="/WEB-INF/templates/segretario.xhtml">
      <ui:define name="titoloSottoSezione">Gestione Corsi di Laurea</ui:define>
      
      <ui:define name="contenuto">
        <h3>Corsi di Laurea:</h3>
        
        <!-- Elenco dei corsi -->
        
          <table border="1" cellspacing="0" cellpadding="2" style="border-style: solid; border-color: #000000">
            <thead class="tableHeader">
              <tr>
                <th style="border-style: solid; border-color: #000000">Nome</th>
                <th style="border-style: solid; border-color: #000000"></th>
              </tr>
            </thead>
            <tbody>
            <ui:fragment rendered="#{mainBean.segretario.corsiBean.numeroCorsi > 0}">
              <ui:repeat value="#{mainBean.segretario.corsiBean.corsi}" var="corsoBean" varStatus="info">
                <tr class="#{info.even ? 'tableRow1' : 'tableRow2'}">
                  <td style="border-style: solid">#{corsoBean.nome}</td>
                  <td style="border-style: solid">
                    <h:form>
                      <h:commandLink value="Cancella" action="#{corsoBean.cancella}"/>
                    </h:form>
                  </td>
                </tr>
              </ui:repeat>
              </ui:fragment>
              <h:form>
                <tr class="tableRowHighlight">
                  <td style="border-style: solid"><h:inputText value="#{mainBean.segretario.corsiBean.nuovoCorso}" required="true" style="width: 100%"/></td>
                  <td style="border-style: solid"><h:commandButton value="Aggiungi" action="#{mainBean.segretario.corsiBean.inserisciCorso}"/></td>
                </tr>
              </h:form>
            </tbody>
          </table>
        <h3>
          <h:outputText rendered="#{mainBean.segretario.corsiBean.numeroCorsi == 0}" value="Nessun corso memorizzato"/>
        </h3> 
      </ui:define>
    </ui:composition>
  </body>
</html>